<extend name="Public/base"/>
<block name="head">
	<link href="__CSS__/article.css" rel="stylesheet">
</block>
<block name="body">
	<div class="container" >
        
		<include file="Public:category" />
		
        <div class="row">
			<div class="col-sm-12 article-list">
				<ul id="ajax-article-list">
					<article:list name="list" row="12" category="$category['id']" child="true">					
						<li style="<if condition='$i%4 gt 0'>margin-right:1%;</if>">
							<a href="{:U('/article/'.$list['id'])}">
								<div class="cover" style="background:url('{$list.cover_id|get_cover=path}') repeat scroll 50% 50% / cover">
								
								</div>		
								
									<div class="title">
										{$list.title}
									</div>
								
								<div class="disc">
									{$list.description}
								</div>
								</a>
								<div class="view-info">
									<ul class="col-md-12 post-info">
										<li class="info-item">
											<i class="glyphicon glyphicon-eye-open"></i>
											<span>{$list.view}</span>			
										</li>
										<li class="info-item">
											<i class="info-icon icon-like" data-id="{$list.id}"></i>
											<span>{$list.favor}</span>			
										</li>
										
										<li class="info-item">
											<i class="info-icon icon-comment"></i>
											<span>{$list.comment}</span>
										</li>
									</ul>
									
								</div>
							
						</li>
					</article:list>
				</ul>
				<button id="next" class="btn" p="2" total-page="{$total_page}">
					点击加载更多
				</button>
				
				

			</div>
	
        </div>
    </div>
</block>
<block name="script">
<script>
	 $(function(){   
		  $('#next').click(function(){
		  	LoadPage();  
		  });
		  highlight_subnav("{:U('Article/index',array('category'=>$top_category['id']))}");
		  $('.category-item').find('a[href="'+'{$url}'+'"]').addClass('active');  

	}); 
	function LoadPage(){
		var currentPage = $('#next').attr('p') ? $('#next').attr('p') : 1;
		$.get("{:U('Article/ajaxArticleList?category='.$id)}",{p:currentPage},function(result){
			if(result.errno==0){
				$('#ajax-article-list').append(result.content);
				$('#next').attr('p',result.p);
				if(result.p>$('#next').attr('total-page')){
					$('#next').html('木有了，亲');
					$('#next').attr('disabled',true);
					$('#next').addClass('disabled');
				}
			}
			
		},'json');	
	}
	</script>	 
</block>